#ifndef DATABASE_H
#define DATABASE_H
#include <QSqlDatabase>
#include <QSqlQuery>
#include <QObject>
static bool createConnection()
{

    QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE");
    db.setDatabaseName("waterData.db");
    if(!db.open()) return false;
    QSqlQuery query;
    query.exec(QObject::tr("create table user (id int, name vchar primary key,passWord vchar)"));
    query.exec(QObject::tr("insert into user values (1,'土豆',666)"));
    query.exec(QObject::tr("insert into user values (2,'西瓜',666)"));

return true;
}
#endif // DATABASE_H
